package com.wxzhou.wangzhuan.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;

/**
 * 提现汇总pojo，用于汇总每个用户的提现情况
 * 持久化到数据库和redis保持一致
 */
public class WithdrawSummary {


    private Long userId;

    /**
     * 最后一次提现时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    private LocalDateTime lastTime;

    /**
     * 最后一次提现状态
     */
    private Integer lastStatus;

    /**
     * 当日累计提现次数
     */
    private Integer dailyCount;

    /**
     * 当日提现成功次数
     */
    private Integer dailySuccessCount;

    /**
     * 当日提现处理中的总次数
     */
    private Integer dailyPendingCount;

    /**
     * 当日累计提现金额
     */
    private BigDecimal dailyAmount;

    /**
     * 当日成功提现金额
     */
    private BigDecimal dailySuccessAmount;

    /**
     * 当日处理中的提现总金额
     */
    private BigDecimal dailyPendingAmount;

    /**
     * 用户累计提现金额
     */
    private BigDecimal totalAmount;

    /**
     * 按用户提现金额作为key，value包含该金额下的：累计提现成功次数（提现成功）、当日提现成功次数、累计提现失败次数（提现失败）、当日提现失败次数、累计提现中次数、当日提现中次数。
     */
    private Map<String, WithdrawUserSummaryItem> amountItems = new HashMap<>();

    public WithdrawSummary() {
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public LocalDateTime getLastTime() {
        return lastTime;
    }

    public void setLastTime(LocalDateTime lastTime) {
        this.lastTime = lastTime;
    }

    public Integer getLastStatus() {
        return lastStatus;
    }

    public void setLastStatus(Integer lastStatus) {
        this.lastStatus = lastStatus;
    }

    public Integer getDailyCount() {
        return dailyCount;
    }

    public void setDailyCount(Integer dailyCount) {
        this.dailyCount = dailyCount;
    }

    public Integer getDailySuccessCount() {
        return dailySuccessCount;
    }

    public void setDailySuccessCount(Integer dailySuccessCount) {
        this.dailySuccessCount = dailySuccessCount;
    }

    public Integer getDailyPendingCount() {
        return dailyPendingCount;
    }

    public void setDailyPendingCount(Integer dailyPendingCount) {
        this.dailyPendingCount = dailyPendingCount;
    }

    public BigDecimal getDailyAmount() {
        return dailyAmount;
    }

    public void setDailyAmount(BigDecimal dailyAmount) {
        this.dailyAmount = dailyAmount;
    }

    public BigDecimal getDailySuccessAmount() {
        return dailySuccessAmount;
    }

    public void setDailySuccessAmount(BigDecimal dailySuccessAmount) {
        this.dailySuccessAmount = dailySuccessAmount;
    }

    public BigDecimal getDailyPendingAmount() {
        return dailyPendingAmount;
    }

    public void setDailyPendingAmount(BigDecimal dailyPendingAmount) {
        this.dailyPendingAmount = dailyPendingAmount;
    }

    public Map<String, WithdrawUserSummaryItem> getAmountItems() {
        return amountItems;
    }

    public void setAmountItems(Map<String, WithdrawUserSummaryItem> amountItems) {
        this.amountItems = amountItems;
    }

    public BigDecimal getTotalAmount() {
        return totalAmount;
    }

    public void setTotalAmount(BigDecimal totalAmount) {
        this.totalAmount = totalAmount;
    }
}
